Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@smithy/node-http-handler

Package Overview
Dependencies
6
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @smithy/node-http-handler

Provides a way to make requests


Version published
Weekly downloads
12M
decreased by-15.81%
Maintainers
2
Install size
484 kB
Created
Weekly downloads
 

Package description

What is @smithy/node-http-handler?

@smithy/node-http-handler is a package that provides HTTP request handling capabilities for Node.js applications. It is part of the Smithy framework, which is used for building SDKs and clients for AWS services. This package is specifically designed to handle HTTP requests and responses, making it easier to interact with web services.

What are @smithy/node-http-handler's main functionalities?

HTTP Request Handling

This feature allows you to handle HTTP requests using the NodeHttpHandler class. The code sample demonstrates how to create an HTTP request and handle the response.

const { NodeHttpHandler } = require('@smithy/node-http-handler');
const { HttpRequest } = require('@smithy/protocol-http');

const handler = new NodeHttpHandler();
const request = new HttpRequest({
  hostname: 'example.com',
  path: '/path',
  method: 'GET'
});

handler.handle(request).then(response => {
  console.log(response.statusCode);
  console.log(response.body);
}).catch(error => {
  console.error(error);
});

Custom HTTP Options

This feature allows you to customize HTTP options such as connection timeout and socket timeout. The code sample demonstrates how to set these options when creating a NodeHttpHandler instance.

const { NodeHttpHandler } = require('@smithy/node-http-handler');
const { HttpRequest } = require('@smithy/protocol-http');

const handler = new NodeHttpHandler({
  connectionTimeout: 3000,
  socketTimeout: 3000
});
const request = new HttpRequest({
  hostname: 'example.com',
  path: '/path',
  method: 'GET'
});

handler.handle(request).then(response => {
  console.log(response.statusCode);
  console.log(response.body);
}).catch(error => {
  console.error(error);
});

Other packages similar to @smithy/node-http-handler

Readme

Source

@smithy/node-http-handler

NPM version NPM downloads

FAQs

Last updated on 14 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc